﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using PromotionApp.BLL;
using PromotionApp.Model;

namespace PromotionApp.Utility
{
    public class BackendBasePage : BasePage
    {        
        #region Event

        protected override void OnInit(EventArgs e)
        {
            ValidateUserRole();
            base.OnInit(e);
        }

        #endregion

        #region Private Method

        protected override void ValidateUserRole()
        {
            base.GetUserRoleNew();

            switch (this._UserRole)
            {
                case UserRole.User:                    
                case UserRole.Modulator_Pending:                    
                case UserRole.Modulator_Disabled:                                    
                case UserRole.Administrator_Pending:                    
                case UserRole.Administrator_Disabled:                    
                case UserRole.Undefined:
                    this.Response.Redirect("BackendUnauthorizedPage.aspx");
                    break;
                default:
                    break;
            }
        }        

        #endregion
        
    }
}